/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-10-26
 * Time: 14:58
 */
import java.util.Scanner;

public class Main{
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        Ticket a = new WalkupTicket(in.nextInt());
        System.out.println(a.toString());
        Ticket b = new AdvanceTicket(in.nextInt(), in.nextInt());
        System.out.println(b.toString());
        Ticket c = new StudentAdvanceTicket(in.nextInt(), in.nextInt(), in.nextInt());
        System.out.println(c.toString());
    }
}

/* 请在这里填写答案 */
abstract class Ticket{
    private int num;
    Ticket(int number){
        num=number;
    }
    abstract int getPrice();

    @Override
    public String toString() {
        return "Number:"+num+",Price:"+getPrice();
    }

}
class WalkupTicket extends Ticket{
    WalkupTicket(int number){
        super(number);
    }

    @Override
    int getPrice() {
        return 50;
    }
}
class AdvanceTicket extends Ticket {
    private int leadTime;

    AdvanceTicket(int number, int leadTime) {
        super(number);
        this.leadTime = leadTime;
    }

    public int getLeadTime() {
        return leadTime;
    }

    @Override
    int getPrice() {
        if (leadTime > 10) {
            return 30;
        }
        return 40;
    }
}
class StudentAdvanceTicket extends AdvanceTicket{
    private int height;

    StudentAdvanceTicket(int number, int leadTime, int height) {
        super(number, leadTime);
        this.height=height;
    }

    @Override
    int getPrice() {
        if(height>120){
            if(getLeadTime()>10){
                return 20;
            }
            else {
                return 30;
            }
        }
        else if(height<=120){
            if(getLeadTime()>10){
                return 10;
            }
            else {
                return 15;
            }
        }
        return -1;
    }
}